package com.chpro.spittr;

import java.util.Date;

import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;

import com.chpro.spittr.alerts.AlertService;
import com.chpro.spittr.domain.Spittle;

public class JmsMain {
	public static void main(String[] args)throws Exception {
		ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("spring/applicationContext-jms.xml");
		AlertService alertService = app.getBean(AlertService.class);
		//发送一个消息
		Spittle spittle = new Spittle(1L,"hello",new Date());
		alertService.sendSpittleAlert(spittle);
		
		//接收一个消息
		Spittle s = alertService.receiveSpittleAlert();
		System.out.println(s.getMessage());
	}
}
